import java.util.ArrayList;
import java.util.List;

/**
 * @author MyPC
 * @date 2018/6/28
 */

public class StudentDaoImpl implements StudentDao {

    private List<Student> mStudents;


    public StudentDaoImpl() {
        mStudents=new ArrayList<Student>();
        mStudents.add(new Student("jake",0));
        mStudents.add(new Student("rose",1));
        mStudents.add(new Student("lucy",2));
    }

    public List<Student> getAllStudents() {
        return mStudents;
    }
    //获取单个对象数据
    public Student getStudent(int rollNo) {
        return mStudents.get(rollNo);
    }

    public void updateStudent(Student student) {
            mStudents.get(student.getRollNo()).setName(student.getName());
    }

    public void deleteStudent(Student student) {
        mStudents.remove(student);
    }
}
